/**
 * @(#)AdController.java 2017年4月10日
 * Copyright(C) 2017 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import javax.annotation.Resource;

import org.jsbd.boss.service.IHotWordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 
 * TODO 请加入本类的说明
 * @author <a href="mailto:zhangbinghua@zhexinit.com" >zbh</a>
 * @version 1.0.0
 */
@Controller
@RequestMapping("/hotword")
public class BaiduHotwordController {
	public static final Logger LOGGER = LoggerFactory.getLogger(BaiduHotwordController.class);

	@Resource
	private IHotWordService hotWordService;

	@RequestMapping(value = "list", method = RequestMethod.GET)
	@ResponseBody
	public List<String> list(Integer length, Model model) {
		if(length==null||length>20||length<1){
			length=5;
		}
		return hotWordService.selectHotwords(length);
	}
    
	@RequestMapping(value = "getIDphotoName", method = RequestMethod.GET)
	@ResponseBody
	public List<String> getIDphotoName() {
		List<String> result =  new ArrayList<String>();
		result.add(hotWordService.getIdPhoto());
		result.add(hotWordService.getNickName());
		return result;
	}

}
